const { http } = uni.$u
// 获取菜单
export const getuser = (code,oid,config = {}) => http.post('/SysUser/GetUserByWx?code='+code+"&openid="+oid, code, config)
export const login = (par, config = {}) => http.post('/SysUser/Login', par, config)
export const addbuild = (par, config = {}) => http.post('/BuildInfo/Insert', par, config)
export const getbuildlist = (par, config = {}) => http.post('/BuildInfo/GetList', par, config)
export const getbuildbyid = (par, config = {}) => http.post('/BuildInfo/GetById?id='+par, par, config)
export const updatebuild = (par, config = {}) => http.post('/BuildInfo/Update', par, config)
export const getbuildcount = (start,end,year,month,par, config = {}) => http.post(`/BuildInfo/BuildCount2?year=${year}&month=${month}&start=${start}&end=${end}`, par, config)
export const ChangeSend = (par, config = {}) => http.post('/BuildInfo/ChangeSend', par, config)
export const SendWork = (buildid,userid,teamid,config = {}) => http.post(`/BuildInfo/SendWork?userid=${userid}&teamid=${teamid}`, buildid, config)
export const getno = (par, config = {}) => http.post('/BuildInfo/GetNo', par, config)
export const IncomeByCity = (start,end,par,config = {}) => http.post(`/Count/IncomeByCity?start=${start}&end=${end}`,par,config)
export const PayByCity = (start,end,par,config = {}) => http.post(`/Count/PayByCity?start=${start}&end=${end}`,par,config)
export const SafeByCompany = (start,end,TeamType,par,config = {}) => http.post(`Count/SafeByCompany?start=${start}&end=${end}&TeamType=${TeamType}`,par,config)
export const DailyByCompany = (start,end,TeamType,par,config = {}) => http.post(`Count/DailyByCompany?start=${start}&end=${end}&TeamType=${TeamType}`,par,config)

export const getbuilddailylist = (par, config = {}) => http.post('/BuildDaily/GetList', par, config)
export const getbuilddailybyid = (par, config = {}) => http.post('/BuildDaily/GetById?id='+par, par, config)
export const addbuilddaily = (par, config = {}) => http.post('/BuildDaily/Insert', par, config)
export const addtempdaily = (par, config = {}) => http.post('/BuildDaily/InsertTemp', par, config)

export const getbuildchecklist = (par, config = {}) => http.post('/BuildCheck/GetList', par, config)
export const getbuildcheckbyid = (par, config = {}) => http.post('/BuildCheck/GetById?id='+par, par, config)
export const addbuildcheck = (par, config = {}) => http.post('/BuildCheck/Insert', par, config)

export const getbuildsafelist = (par, config = {}) => http.post('/BuildSafe/GetList', par, config)
export const getbuildsafebyid = (par, config = {}) => http.post('/BuildSafe/GetById?id='+par, par, config)
export const addbuildsafe = (par, config = {}) => http.post('/BuildSafe/Insert', par, config)

export const getlinelist = (region, par, config = {}) => http.post(`/Line/GetList?region=${region}`, par, config)
export const getlinebyid = (par, config = {}) => http.post('/Line/GetById?id='+par, par, config)
export const searchline = (par, config = {}) => http.post('/Line/Search?keyword='+par, par, config)
export const addline = (par, config = {}) => http.post('/Line/Insert', par, config)
export const changebuttons = (bt, par, config = {}) => http.get(`/Line/setbt?bt=${bt}`, par, config)
export const addlineequ = (par, config = {}) => http.post('/LineEqu/Insert', par, config)
export const addLinePathNode = (par, config = {}) => http.post('/LinePathNode/Insert', par, config)
export const getlineequlist = (par, config = {}) => http.post(`/LineEqu/GetList`, par, config)
export const getSimpleNodeList = (region, par, config = {}) => http.post(`/LinePathNode/GetSimpleList?region=${region}`, par, config)
export const getLinePathNodelist = (region, par, config = {}) => http.post(`/LinePathNode/GetList?region=${region}`, par, config)
export const getClickNode = (markid, level, par, config = {}) => http.post(`/LinePathNode/NodeClick?markid=${markid}&level=${level}`, par, config)
export const getLineNodeList = (keyword,lng, lat, par, config = {}) => http.post(`/LinePathNode/SearchMap?keyword=${keyword}&doubleLng=${lng}&doubleLat=${lat}`, par, config)
export const deleteline = (par, config = {}) => http.post('/Line/DeleteByIds', par, config)
export const deletelineequ = (par, config = {}) => http.post('/LineEqu/DeleteByIds', par, config)
export const deleteLinePathNode = (par, config = {}) => http.post('/LinePathNode/DeleteByIds', par, config)
export const GetAddrByLatlng = (par, config = {}) => http.post('/Line/GetAddrByLatlng?latlng='+par, par, config)
export const LinePathNodeUpdate = (par, config = {}) => http.post('/LinePathNode/Update',par,config)
export const LineequUpdate = (par, config = {}) => http.post('/LineEqu/Update',par,config)
export const LineequShelfNos = (nodeid, par, config = {}) => http.post(`/LineEqu/ShelfNos?nodeid=${nodeid}`, par, config)
export const GetConnectIds = (equid, point, ForB, par, config = {}) => http.post(`/LineConnect/GetConnectIds?equid=${equid}&point=${point}&ForB=${ForB}`)
export const GetEquByNode = (nodeid, par, config = {}) => http.post(`/LineConnect/GetEquByNode?nodeid=${nodeid}`, par, config)
export const AddLineConnect = (par, config = {}) => http.post(`/LineConnect/Insert`, par, config)
export const Used = (equid, ForB, par, config = {}) => http.post(`/LineConnect/Used?equid=${equid}&ForB=${ForB}`, par, config)
export const DeleteConnect = (equid, points, ForB, par, config = {}) => http.post(`/LineConnect/DeleteConnect?equid=${equid}&points=${points}&ForB=${ForB}`)

export const addLineCheck = (par, config = {}) => http.post('LineCheck/InsertList', par, config)
export const getCheckLine = (date, par, config = {}) => http.post(`/LineCheck/getCheckLine?date=${date}`, par, config)
export const getlinefiber = (region, par, config = {}) => http.post(`/LineFiber/GetList?region=${region}`, par, config)
export const getClickMapList = (region, lat, lng, par, config = {}) => http.post(`/LineFiber/ClickMap?region=${region}&lat=${lat}&lng=${lng}`, par, config)
export const addLinefiber = (par, config = {}) => http.post('/LineFiber/Insert', par, config)
export const deleteLinefiber = (par, config = {}) => http.post('/LineFiber/DeleteByIds', par, config)
export const LinefiberUpdate = (par, config = {}) => http.post('LineFiber/Update', par, config)
export const getlinefibernode = (par, config = {}) => http.post(`/LineFiberNode/GetList`, par, config)
export const addFiberNode = (clickIdx, par, config = {}) => http.post(`/LineFiberNode/Insert?clickIdx=${clickIdx}`, par, config)
export const fiberNodeUpdate = (par, config = {}) => http.post('/LineFiberNode/Update',par,config)
export const delFiberNode = (fiberid, nodeid, par, config = {}) => http.post(`/LineFiberNode/Delete?fiberid=${fiberid}&nodeid=${nodeid}`, par, config)
export const BrokenPoint = (startid, endid, length, par, config = {}) => http.post(`/LineFiberNode/BrokenPoint?startid=${startid}&endid=${endid}&length=${length}`, par, config)
export const getlinefiberlist = (region, id, level, par, config = {}) => http.post(`/LineFiber/GetLineList?region=${region}&id=${id}&level=${level}`, par, config)
export const getClickFiberList = (region, lat, lng, id, par, config = {}) => http.post(`/LineFiber/ClickFiber?region=${region}&lat=${lat}&lng=${lng}&id=${id}`, par, config)

export const gettodolist = (par, config = {}) => http.post('/SysFlowRecord/todo', par, config)
export const getFlowRecordList = (par, config = {}) => http.post('/SysFlowRecord/GetList', par, config)

export const getfilebyoutid= (par, config = {}) => http.post(`/SysFile/GetListByOutId?outid=${par}`, par, config)

export const getvcodeimg= (code, config = {}) => http.post(`/SysUser/GetVcode?code=${code}`, code, config)

export const getuserlist= (par, config = {}) => http.post(`/SysUser/getlist`, par, config)
export const sendwxmsg= (par, config = {}) => http.post(`/SysUser/sendwxmsg`, par, config)

export const CountByDay= (par, config = {}) => http.post(`/BuildDaily/CountByDay?time=${par}`, par, config)
// export const ListByDay= (par, config = {}) => http.post(`/BuildDaily/ListByDay?time=${par}`, par, config)
export const ListByDay= (par,time,isSubmit, config = {}) => http.post(`/BuildDaily/ListByDay2?time=${time}&isSubmit=${isSubmit}`, par, config)
export const ListByBuild= (buildid, config = {}) => http.post(`/BuildDaily/ListByBuild?buildid=${buildid}`, buildid, config)
export const NotByDay= (par, config = {}) => http.post(`/BuildDaily/NotByDay?time=${par}`, par, config)
export const addbuildsafecheck = (par, config = {}) => http.post('/BuildSafeCheck/Insert', par, config)

export const getprojlist = (par, config = {}) => http.post('/ProjInfo/GetList', par, config)
export const todocount = (par, config = {}) => http.post('/SysFlow/todocount', par, config)
export const end=(par, config = {})=>   http.post(`/SysFlow/Finish?recordid=${par}`,null,  config)
export const GetChangeSendList=(par, config = {})=>   http.post(`/WorkTeam/GetChangeSendList?SecondUnit=${par}`,null,  config)
export const getrecodelist=(par, config = {}) =>  http.post(`/SysFlowRecord/Query`, par, config)

export const getbuildfinishlist = (par, config = {}) => http.post('/BuildFinish/GetList', par, config)
export const getbuildfinishbyid = (par, config = {}) => http.post(`/BuildFinish/GetById?Id=${par}`, null, config)
export const addbuildfinish = (par, config = {}) => http.post('/BuildFinish/Insert', par, config)

export const getworkteamlist = (par, config = {}) => http.post('/WorkTeam/GetList', par, config)

export const GetByDeptName = (par, config = {}) => http.post(`/SysUser/GetByDeptName?deptname=${par}`, par, config)
export const GetFGSname = (deptId,par, config = {}) => http.post(`/SysDept/GetFGSname?deptId=${deptId}`, null, config)

export const getbuildputrightlist = (par, config = {}) => http.post('/BuildPutRight/GetList', par, config)
export const getbuildputrightbyid = (par, config = {}) => http.post(`/BuildPutRight/GetById?Id=${par}`, null, config)
export const addbuildputright = (par, config = {}) => http.post('/BuildPutRight/Insert', par, config)
export const gettodo = (par, config = {}) => http.post(`/BuildPutRight/GetToDo?Id=${par}`, null, config)
export const getputrightrecodelist = (par, config = {}) => http.post(`/BuildPutRight/GetToDoList?outid=${par}`, null, config)
export const getflowrecordbyid = (par, config = {}) => http.post(`/SysFlowRecord/GetById?id=${par}`, null, config)
export const wxlogin = (code,userid, config = {}) => http.post(`/SysUser/WXlogin?code=${code}&userid=${userid}`, null, config)
export const towxlogin = (code,userid, config = {}) => http.post(`/SysUser/WXlogin2?code=${code}`, null, config)

export const GetCMList = (par, config = {}) => http.post('/Warn/GetCMList', par, config)
export const getfaultlist = (par, config = {}) => http.post('/Fault/GetList', par, config)
export const addfault = (par, config = {}) => http.post('/Fault/Insert', par, null, config)
export const delfault = (ids, config = {}) => http.post('/Fault/DeleteByIds', ids, config)
// export const pingfault = (ids, config = {}) => http.post('/Fault/ping', ids, config)
// export const checkZTEpoint = (ids, config = {}) => http.post('/Fault/CheckZTEpoint', ids, config)
// export const CheckToppoint = (ids, config = {}) => http.post('/Fault/CheckToppoint', ids, config)
export const CheckAll = (ids, config = {}) => http.post('/Fault/CheckAll', ids, config)
export const checkfault = (ids, config = {}) => http.post('/Fault/Check', ids, config)
export const uncheckfault = (ids, config = {}) => http.post('/Fault/UnCheck', ids, config)
export const faultgetcount = ( config = {}) => http.post('/Fault/getcount', null, config)
export const GetUpChannelList = (par, config = {}) => http.post('/Warn/GetUpChannelList', par, config)
export const GetProtOpticalPowerList = (par, config = {}) => http.post('/ProtOpticalPower/GetList', par, config)
export const CheckOnuPower = (ids, config = {}) => http.post('/ProtOpticalPower/CheckOnuPower', ids, config)

export const scancode = (code, par, config = {}) => http.post(`/StoreEqu/ScanCode?code=${code}`, par, config)
export const getequ = (par, config = {}) => http.post(`/StoreEqu/GetList`, par, config)
export const getstoreinfo = (par, config = {}) => http.post(`/StoreChange/GetList`, par, config)

export const getworkerslist = (par, config = {}) => http.post('/BuildWorkers/GetList',par,config)
export const workerupdate = (par, config = {}) => http.post('/BuildWorkers/Update',par,config)

export const getcarlist = (par, config = {}) => http.post('/Car/GetList',par,config)
export const addcar = (par, config = {}) => http.post('/Car/Insert',par,config)
export const delcar = (ids, config = {}) => http.post('/Car/DeleteByIds', ids, config)
export const carupdate = (par, config = {}) => http.post('/Car/Update',par,config)
export const addcarapply = (par, config = {}) => http.post('/CarApply/Insert',par,config)
export const carout = (par, config = {}) => http.post('/CarApply/CarOut',par,config)
export const caroutstart = (par, config = {}) => http.post('/CarApply/CarOutStart',par,config)
export const getcarapply = ( istodo, par,  config = {}) => http.post(`/CarApply/GetList?istodo=${istodo}`,par,config)
export const applyupdate = (par, config = {}) => http.post('/CarApply/Update',par,config)
export const delapply = (ids, config = {}) => http.post('/CarApply/DeleteByIds', ids, config)
export const getinsurancelist = (par, config = {}) => http.post('/CarInsurance/GetList',par,config)
export const addinsurance = (par, config = {}) => http.post('/CarInsurance/Insert',par,config)
export const insuranceupdate = (par, config = {}) => http.post('/CarInsurance/Update',par,config)
export const delinsurance = (ids, config = {}) => http.post('/CarInsurance/DeleteByIds', ids, config)
export const getmaintenancelist = (par, config = {}) => http.post('/CarMaintenance/GetList',par,config)
export const addmaintenance = (par, config = {}) => http.post('/CarMaintenance/Insert',par,config)
export const maintenanceupdate = (par, config = {}) => http.post('/CarMaintenance/Update',par,config)
export const delmaintenance = (ids, config = {}) => http.post('/CarMaintenance/DeleteByIds', ids, config)

export const getorderlist = (par, config = {}) => http.post('/ProtOrder/GetList',par,config)
export const getaddrslist = (par, config = {}) => http.post('/SysAddr/GetList',par,config)
export const addorder = (par, config = {}) => http.post('/ProtOrder/Insert', par, config)
export const delorder = (ids, config = {}) => http.post('/ProtOrder/DeleteByIds', ids, config)
export const getaddrbylevel = (level, config = {}) => http.post(`/SysAddr/GetListByLevel?Level=${level}`,config)
export const getaddrbypcode = (pcode, config = {}) => http.post(`/SysAddr/GetListByPcode?Pcode=${pcode}`,config)

export const GoNext=(actionid,cometype,userid,remark,flowid,outid,dataname,urlparam, config = {})=>
   http.post(`/SysFlow/GoNext?actionid=${actionid}&cometype=${cometype}&userid=${userid}&remark=${remark}&flowid=${flowid}&outid=${outid}&dataname=${dataname}&urlparam=${urlparam||''}`,null,config)


export const  GetCurrentAct=(outid, config = {}) =>
   http.post(`/SysFlow/GetCurrentAct?outid=${outid}`,outid, config)


export const  GetNextOption=(outid,cometype,flowid,deptid, config = {}) =>
  http.post(`/SysFlow/GetNextOption?outid=${outid}&cometype=${cometype}&flowid=${flowid}&deptid=${deptid}`,null,config)


export  function GetListByParent(ob,outre) {
  return http.post(`/SysDic/GetListByParent?pname=`+ob,  ob).then(res=>{
    if(res.length !== 0)
    {
      res.forEach((item)=>{outre.push({name:item.Name})})
    }
    
    else
      return "网络故障"
  })
}

const S4 = function() {
  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
export function guid() {
  return (S4() + S4() +'-' +S4() +'-' +S4() +'-' +S4() +'-' +S4() +S4() +S4());
}

export const city= [
  {
      name: "南宁市",
      code:"NBC",
      districtAndCounty: ["青秀区", "兴宁区", "江南区", "西乡塘区", "良庆区", "邕宁区", "武鸣县", "横县","横州", "宾阳县", "上林县", "隆安县", "马山县"]
  },
  {
      name: "桂林市",
      code:"GH",
      districtAndCounty: ["象山区", "叠彩区", "秀峰区", "七星区", "雁山区", "阳朔县", "阳朔镇", "临桂县", "临桂镇", "灵川县", "灵川镇", "全州县", "全州镇", "兴安县", "兴安镇", "永福县", "永福镇", "灌阳县", "灌阳镇", "资源县", "资源镇", "平乐县", "平乐镇", "荔浦县", "荔城镇", "龙胜各族自治县", "龙胜镇", "恭城瑶族自治县", "恭城镇"]
  },
  {
      name: "柳州市",
      code:"LHL",
      districtAndCounty: ["城中区", "鱼峰区", "柳南区", "柳北区", "柳江县", "拉堡镇", "柳城县", "大埔镇", "鹿寨县", "鹿寨镇", "融安县", "长安镇", "三江侗族自治县", "古宜镇", "融水苗族自治县", "融水镇"]
  },
  {
      name: "梧州市",
      code:"WYG",
      districtAndCounty: ["万秀区", "蝶山区", "长洲区", "岑溪市", "苍梧县", "龙圩镇", "藤县", "藤州镇", "蒙山县", "蒙山镇"]
  },
  {
      name: "贵港市",
      code:"WYG",
      districtAndCounty: ["港北区", "港南区", "覃塘区", "桂平市", "平南县", "平南镇"]
  },
  {
      name: "玉林市",
      code:"WYG",
      districtAndCounty: ["玉州区", "北流", "兴业县", "石南镇", "容县", "容州镇", "陆川县", "陆城镇", "博白县", "博白镇"]
  },
  {
      name: "钦州市",
      code:"QBF",
      districtAndCounty: ["钦南区", "钦北区", "灵山县", "灵城镇", "浦北县", "小江镇"]
  },
  {
      name: "北海市",
      code:"QBF",
      districtAndCounty: ["海城区", "银海区", "铁山港区", "合浦县", "廉州镇"]
  },
  {
      name: "防城港市",
      code:"QBF",
      districtAndCounty: ["港口区", "防城区", "东兴", "上思县", "思阳镇"]
  },
  {
      name: "崇左市",
      code:"NBC",
      districtAndCounty: ["江州区", "凭祥市", "扶绥县", "新宁镇", "大新县", "桃城镇", "天等县", "天等镇", "宁明县", "城中镇", "龙州县", "龙州镇"]
  },
  {
      name: "百色市",
      code:"NBC",
      districtAndCounty: ["右江区", "田阳县", "田州镇", "田东县", "平马镇", "平果县", "马头镇", "德保县", "城关镇", "靖西县", "新靖镇", "那坡县", "城厢镇", "凌云县", "泗城镇", "乐业县", "同乐镇", "西林县", "八达镇", "田林县", "乐里镇", "隆林"]
  },
  {
      name: "河池市",
      code:"LHL",
      districtAndCounty: ["金城江", "宜州", "南丹县", "城关镇", "天峨县", "六排镇", "凤山县", "凤城镇", "东兰县", "东兰镇", "巴马瑶族自治县", "巴马镇", "都安瑶族自治县", "安阳镇", "大化瑶族自治县", "大化镇", "罗城仫佬族自治县", "东门镇", "环江毛南族自治县","环江", "思恩镇"]
  },
  {
      name: "来宾市",
      code:"LHL",
      districtAndCounty: ["兴宾区", "合山市", "象州县", "象州镇", "武宣县", "武宣镇", "忻城县", "城关镇", "金秀瑶族自治县", "金秀镇"]
  },
  {
      name: "贺州市",
      code:"GH",
      districtAndCounty: ["八步区", "昭平县", "昭平镇", "钟山县", "钟山镇", "富川瑶族自治县", "富阳镇"]
  },
  {
    name: "广西",
    code:"RXGS",
    districtAndCounty: []
}
]